package load.drawing;

import core.InPort;
import core.StdNode;
import core.TriggerPort;
import java.awt.Color;
import java.awt.Graphics;

/**
 *
 * @author Ben
 */
public class DrawString extends StdNode{
    private InPort x = new InPort(Integer.class);
    private InPort y = new InPort(Integer.class);
    private InPort text = new InPort(Object.class);
    private InPort color = new InPort(Color.class);

    private TriggerPort draw = new TriggerPort() {
            @Override
            public void callInternal() {
                Graphics g = controller.StdDraw.getInstance().getGraphics();
                g.setColor((Color)color.getValue());
                g.drawString((String)text.getValue(),(Integer) x.getValue(),
                            (Integer)y.getValue());
            }
    };

    public DrawString() {
        this.autoPutPorts();
    }

}
